<?php

try {
	$debug = true;
	
	//$_SERVER['HTTP_X_REWRITE_URL'] = '/Highnet/Smart-Framework/Google-svn/demos/iDo/';

	$root = dirname(__FILE__);
	$ds = DIRECTORY_SEPARATOR;
	set_include_path(	$root. $ds . PATH_SEPARATOR  										//this dir
									. $root . $ds . 'Library' . $ds . PATH_SEPARATOR 		//library
									. $root . $ds . 'Application' . $ds . PATH_SEPARATOR	//application
									. get_include_path());		//old path
	require_once 'Library/includes.php'; // Include path settings specific for local machine

	// Register autoload (required by Doctrine)
	require_once 'Zend/Loader.php';
	require_once 'Doctrine.php';
	Zend_loader::registerAutoload('Doctrine');

	// Initialize SmartL_Application
	require_once 'SmartL/Application.php';
	require_once 'iDo/Login.php';
	$application = SmartL_Application::getInstance();

	//Global cache for config - uncomment for enable config caching
	/*require_once 'Zend/Cache.php';
	SmartL_Config::setCache(Zend_Cache::factory('Core','File',array('lifetime'=>60),
		array('cache_dir'=>dirname(__FILE__).'/Application/Data/ConfigCache')));*/

	// Init application
	$application->init(dirname(__FILE__), "Application" . $ds . "Config", 
		new iDo_Login() );

	// Start dispatching
	$application->start();
}
catch (Exception $e) {
	if ( $debug ) {
		throw $e;
	}
	else {
		include 'Public/error.html';
	}
}